package com.clkj.goldpartner.service.impl;

import com.clkj.goldpartner.dao.GoodsMapper;
import com.clkj.goldpartner.pojo.Goods;
import com.clkj.goldpartner.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author 杨阿旺
 * @date 2021-03-02 14:39
 */
@Service
public class GoodsServiceImpl implements GoodsService {
    @Autowired
    private GoodsMapper goodsMapper;

    /**
     * 获取最后一位编号
     *
     * @return String
     */
    @Override
    public String getGoods_num() {
        return goodsMapper.getGoods_num();
    }

    /**
     * 添加商品
     *
     * @param goods
     * @return
     */
    @Override
    public Integer addGoods(Goods goods) {
        goodsMapper.addGoods(goods);
        return goods.getGoods_id();
    }

    /**
     * 模糊查询商品信息
     *
     * @param names
     * @param shop_id
     * @return
     */
    @Override
    public List<Map> listGoods(String names, Integer shop_id,String UDI) {
        return goodsMapper.listGoods(names, shop_id,UDI);
    }

    /**
     * 删除商品
     *
     * @param ids
     */
    @Override
    public void updateStatus(String ids) {
        goodsMapper.updateStatus(ids);
    }

    /**
     * 货品进货明细
     *
     * @param goods_num
     * @param shop_id
     * @return
     */
    @Override
    public List<Map<String, Object>> goodsListTotal(String goods_num, Integer shop_id) {
        return goodsMapper.goodsListTotal(shop_id, goods_num);
    }

    /**
     * 供货商供货汇总
     *
     * @param shop_id
     * @param supplier_id
     * @param start_time
     * @param end_time
     * @return
     */
    @Override
    public List<Map<String, Object>> goodsListGyTotal(Integer shop_id, Integer supplier_id, String start_time, String end_time) {
        return goodsMapper.goodsListGyTotal(shop_id, supplier_id, start_time, end_time);
    }

    /**
     * 货品销售汇总
     *
     * @param shop_id
     * @param customer_name
     * @param start_time
     * @param end_time
     * @return
     */
    @Override
    public List<Map<String, Object>> listGoodsSaleTotal(Integer shop_id, String customer_name, String start_time, String end_time) {
        return goodsMapper.listGoodsSaleTotal(shop_id, customer_name, start_time, end_time);
    }

    /**
     * 商品列表
     *
     * @param goods_num
     * @param goods_name
     * @param goods_format
     * @param category_id
     * @return
     */
    @Override
    public List<Map> listGoodsSearch(Integer shop_id, String goods_num, String goods_name, String goods_format, Integer category_id,String UDI) {
        return goodsMapper.listGoodsSearch(shop_id, goods_num, goods_name, goods_format, category_id,UDI);
    }
}
